import React from 'react';

interface NoDataProps {
  className?: string;
  value?: any;
  emptyText?: string;
}

const NoData: React.FC<NoDataProps> = (props) => {
  const { emptyText = '无', value, className } = props;

  const isString = typeof value === 'string';
  const isNum = typeof value === 'number';

  return (
    <span className={className} title={(isString || isNum) ? value : null}>
      {isNum ? value : (value || emptyText)}
    </span>
  );
};

export default NoData;